<?php
class Article extends DataMapper {

	// Uncomment and edit these two if the class has a model name that
	//   doesn't convert properly using the inflector_helper.
	// var $model = 'template';
	// var $table = 'templates';

	// You can override the database connections with this option
	// var $db_params = 'db_config_name';

	// --------------------------------------------------------------------
	// Relationships
	//   Configure your relationships below
	// --------------------------------------------------------------------

	// Insert related models that Template can have just one of.
	var $has_one = array('user', 
            'category' => array('join_table' => 'articles_categories'),
            'user' => array('join_table', 'articles_users')
            );

	// Insert related models that Template can have more than one of.
	var $has_many = array(
                'course' => array('join_table' => 'courses_articles'),
                'attachment' => array('join_table' => 'articles_attachments')
            );
        
        var $validation = array(
        array(
            'field' => 'title',
            'label' => 'Title',
            'rules' => array('required', 'trim', 'unique', 'min_length' => 5, 'max_length' => 50)
        ),

        array(
            'field' => 'content',
            'label' => 'Content',
            'rules' => array('required', 'trim', 'min_length' => 50)
        )
    );
        
        
}

/* End of file article.php */
/* Location: ./application/models/article.php */
